"use client"

import React, { createContext, useContext, useState, ReactNode } from 'react'

interface DialogContextType {
  settingDialogOpen: boolean
  setSettingDialogOpen: (open: boolean) => void
}

const DialogContext = createContext<DialogContextType | undefined>(undefined)

interface DialogProviderProps {
  children: ReactNode
}

export function DialogProvider({ children }: DialogProviderProps) {
  const [settingDialogOpen, setSettingDialogOpen] = useState(false)

  return (
    <DialogContext.Provider 
      value={{
        settingDialogOpen,
        setSettingDialogOpen
      }}
    >
      {children}
    </DialogContext.Provider>
  )
}

export function useDialog() {
  const context = useContext(DialogContext)
  if (context === undefined) {
    throw new Error('useDialog must be used within a DialogProvider')
  }
  return context
} 